package com.z.controller;


import com.z.entity.Users;
import com.z.result.ResultWrapper;
import com.z.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zz
 * @since 2021-08-13
 */
@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    UsersService usersService;

    @GetMapping("/Hello")
    public String HelloWorld(){

        Users byId = usersService.getById(1);
        System.out.println(byId);
        return "HelloWord";
    }

    // 修改用户角色接口
    @PutMapping("{id}/role")
    public ResultWrapper AssignUserRoles(@PathVariable("id") int id,@RequestBody String rid){


        return usersService.updateRoleOfUser(id,rid);

    }

}

